package com.hnkywl.sts.entity.zjgl;

import com.hnkywl.sts.entity.BaseEntity;
import com.hnkywl.sts.entity.organ.Gsjg;
import com.hnkywl.sts.entity.organ.Khh;
import com.hnkywl.sts.entity.organ.Nbgs;
import com.hnkywl.sts.entity.organ.Qyjg;
import com.hnkywl.sts.entity.sfgl.Sfk;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 说明：信用证
 * 包:        com.hnkywl.sts.entity.zjgl
 * 类描述:    信用证
 * 修改备注: [说明本次修改内容]
 * 版本:        [v1.0]
 */
@Entity
@Table(name = "T_BIZ_XYZ")
@Where(clause = "deleted!='1'")
public class Xyz extends BaseEntity {
    @Id
    @SequenceGenerator(name = "seqXyz", allocationSize = 1, sequenceName = "SEQ_BIZ_XYZ")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqXyz")
    private Long id;

    /**
     * 公司名称
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="NBGS_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg nbgs;
    /**
     * 信用证收付类型    0 应收信用证  1 应付信用证
     */
    private Integer xyzsflx;


    /**
     * 出证日期
     */
    private Date czrq;

    /**
     * 信用证号码
     */
    private String xyzhm;
    /**
     * 审核状态   0 为审核  1 已审核
     */
    private Integer shzt;

    /**
     * 应付出证银行
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="YFCZYH_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Khh yfczyh;

    /**
     * 应收出证银行
     */
    private String ysczyh;

    /**
     * 到期日期
     */
    private Date dqrq;

    /**
     * 使用日期
     */
    private Date syrq;

    /**
     * 借款日期
     */
    private Date jkrq;

    /**
     * 还款日期
     */
    private Date hkrq;

    /**
     * 变现日期
     */
    private Date bxrq;
    /**
     * 信用证状态 1.无状态  2.已还款 3 已变现 4使用
     */
    private Integer status;

    /**
     * 到期金额
     */
    private Double dqje;
    /**
     * 保证金比例
     */
    private String bzjbl;

    /**
     * 出证人
     */
    private String czr;

    /**
     * 收款人
     */
    private String skr;

    /**
     * 收证人
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="SZR_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Qyjg szr;
    /**
     * 交证单位
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="JZDW_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg jzdw;

    /**
     * 交证日期
     */
    private Date jzrq;

    /**
     * 是否我方付息  0 我方  1 他方
     */
    private Integer sfwffx;

    /**
     * 付息额
     */
    private Double lxe;


    /**
     * 备注
     */
    private String bz;


    //收付款
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SFK_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Sfk sfk;

    /**
     * 会计年
     */
    @Column(name = "jiuqi_acctyear")
    private Integer acctyear;
    /**
     * 生成久其凭证时提供的ID
     */
    @Column(name = "jiuqi_uuid")
    private String uuid;
    /**
     * 久其返回的凭证ID
     */
    @Column(name = "jiuqi_voucher_id")
    private String voucherId;
    /**
     * 久其返回的凭证号
     */
    @Column(name = "jiuqi_voucher_num")
    private Integer voucherNum;
    /**
     * “久其插入标示”代码   1=未导入,2=导入开始,3=导入成功
     */
    @Column(name = "jiuqi_insert_flag")
    private Integer insertFlag = 1;
    /**
     * "久其删除标示”代码   1=未删除,2=删除开始,3=删除成功
     */
    @Column(name = "jiuqi_delete_flag")
    private Integer deleteFlag = 1;

    //月利率
    private Double yll;

    /**
     * 是否导入利息  ydr 已导入  wdr 未导入
     */
    private String sfdrlx;

    /**
     * 开证费
     */
    private Double kzf;
    /**
     * 保证金金额
     */
    private Double bzj;

    /**
     * 操作状态
     */
    @Transient
    private String czzt;

    /**
     * 信用证
     */
    @OneToOne(cascade = CascadeType.MERGE, targetEntity = Xyzfy.class)
    @JoinColumn(name = "XYZFY_ID")
    private Xyzfy xyzfy;

    //初始化字段  凡是从老系统导入的为初始化字段  置为 1 其他为非初始化
    private String csh ;

    /**
     * 内部划转收付款
     */
    @OneToMany(fetch = FetchType.LAZY, targetEntity = Xyz.class, mappedBy = "nbhzxyz")
    @NotFound(action = NotFoundAction.IGNORE)
    private List<Xyz> nbhzXyzList;

    //内部划转收付款
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "NBHZXYZ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Xyz nbhzxyz;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Gsjg getNbgs() {
        return nbgs;
    }

    public void setNbgs(Gsjg nbgs) {
        this.nbgs = nbgs;
    }

    public Integer getXyzsflx() {
        return xyzsflx;
    }

    public void setXyzsflx(Integer xyzsflx) {
        this.xyzsflx = xyzsflx;
    }



    public Date getCzrq() {
        return czrq;
    }

    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }

    public String getXyzhm() {
        return xyzhm;
    }

    public void setXyzhm(String xyzhm) {
        this.xyzhm = xyzhm;
    }

    public Integer getShzt() {
        return shzt;
    }

    public void setShzt(Integer shzt) {
        this.shzt = shzt;
    }


    public Date getJkrq() {
        return jkrq;
    }

    public void setJkrq(Date jkrq) {
        this.jkrq = jkrq;
    }

    public Date getDqrq() {
        return dqrq;
    }

    public void setDqrq(Date dqrq) {
        this.dqrq = dqrq;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public BigDecimal getDqje() {
        BigDecimal bigDecimal = new BigDecimal(dqje==null?0:dqje);
        return bigDecimal;
    }

    public void setDqje(Double dqje) {
        this.dqje = dqje;
    }





    public Qyjg getSzr() {
        return szr;
    }

    public void setSzr(Qyjg szr) {
        this.szr = szr;
    }

    public Gsjg getJzdw() {
        return jzdw;
    }

    public void setJzdw(Gsjg jzdw) {
        this.jzdw = jzdw;
    }

    public Date getJzrq() {
        return jzrq;
    }

    public void setJzrq(Date jzrq) {
        this.jzrq = jzrq;
    }



    public String getBz() {
        return bz;
    }

    public void setBz(String bz) {
        this.bz = bz;
    }


    public Sfk getSfk() {
        return sfk;
    }

    public void setSfk(Sfk sfk) {
        this.sfk = sfk;
    }

    public Integer getAcctyear() {
        return acctyear;
    }

    public void setAcctyear(Integer acctyear) {
        this.acctyear = acctyear;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getVoucherId() {
        return voucherId;
    }

    public void setVoucherId(String voucherId) {
        this.voucherId = voucherId;
    }

    public Integer getVoucherNum() {
        return voucherNum;
    }

    public void setVoucherNum(Integer voucherNum) {
        this.voucherNum = voucherNum;
    }

    public Integer getInsertFlag() {
        return insertFlag;
    }

    public void setInsertFlag(Integer insertFlag) {
        this.insertFlag = insertFlag;
    }

    public Integer getDeleteFlag() {
        return deleteFlag;
    }

    public void setDeleteFlag(Integer deleteFlag) {
        this.deleteFlag = deleteFlag;
    }

    public Double getYll() {
        return yll;
    }

    public void setYll(Double yll) {
        this.yll = yll;
    }

    public String getBzjbl() {
        return bzjbl;
    }

    public void setBzjbl(String bzjbl) {
        this.bzjbl = bzjbl;
    }



    public Double getLxe() {
        return lxe;
    }

    public void setLxe(Double lxe) {
        this.lxe = lxe;
    }

    public Date getSyrq() {
        return syrq;
    }

    public void setSyrq(Date syrq) {
        this.syrq = syrq;
    }

    public Integer getSfwffx() {
        return sfwffx;
    }

    public void setSfwffx(Integer sfwffx) {
        this.sfwffx = sfwffx;
    }

    public Date getHkrq() {
        return hkrq;
    }

    public void setHkrq(Date hkrq) {
        this.hkrq = hkrq;
    }

    public Date getBxrq() {
        return bxrq;
    }

    public void setBxrq(Date bxrq) {
        this.bxrq = bxrq;
    }

    public Khh getYfczyh() {
        return yfczyh;
    }

    public void setYfczyh(Khh yfczyh) {
        this.yfczyh = yfczyh;
    }

    public String getYsczyh() {
        return ysczyh;
    }

    public void setYsczyh(String ysczyh) {
        this.ysczyh = ysczyh;
    }

    public String getCzr() {
        return czr;
    }

    public void setCzr(String czr) {
        this.czr = czr;
    }

    public String getSkr() {
        return skr;
    }

    public void setSkr(String skr) {
        this.skr = skr;
    }

    public String getSfdrlx() {
        return sfdrlx;
    }

    public void setSfdrlx(String sfdrlx) {
        this.sfdrlx = sfdrlx;
    }

    public Double getKzf() {
        return kzf;
    }

    public void setKzf(Double kzf) {
        this.kzf = kzf;
    }

    public Double getBzj() {
        return bzj;
    }

    public void setBzj(Double bzj) {
        this.bzj = bzj;
    }

    public String getCzzt() {
        return czzt;
    }

    public void setCzzt(String czzt) {
        this.czzt = czzt;
    }

    public Xyzfy getXyzfy() {
        return xyzfy;
    }

    public void setXyzfy(Xyzfy xyzfy) {
        this.xyzfy = xyzfy;
    }

    public String getCsh() {
        return csh;
    }

    public void setCsh(String csh) {
        this.csh = csh;
    }

    public List<Xyz> getNbhzXyzList() {
        return nbhzXyzList;
    }

    public void setNbhzXyzList(List<Xyz> nbhzXyzList) {
        this.nbhzXyzList = nbhzXyzList;
    }

    public Xyz getNbhzxyz() {
        return nbhzxyz;
    }

    public void setNbhzxyz(Xyz nbhzxyz) {
        this.nbhzxyz = nbhzxyz;
    }
}
